/*******************************************************************************
 *
 * Copyright (c) 2004-2008 by Vivante Corp.  All rights reserved.
 *
 * The material in this file is confidential and contains trade secrets of
 * Vivante Corporation.  This is proprietary information owned by Vivante
 * Corporation.  No part of this work may be disclosed, reproduced, copied,
 * transmitted, or used in any way for any purpose, without the express
 * written permission of Vivante Corporation.
 *
 ******************************************************************************/

/*******************************************************************************
 *
 * This file is automatically generated on Mon Apr 13 01:22:32 2009
 *
 * Any changes made to this file are lost at the next compile run!
 * So better make sure you update the source .r files instead!
 *
 ******************************************************************************/

////////////////////////////////////////////////////////////////////////////////
//                                ~~~~~~~~~~~~~                               //
//                                Module Tokens                               //
//                                ~~~~~~~~~~~~~                               //
////////////////////////////////////////////////////////////////////////////////

// Register AQStall.
// ~~~~~~~~~~~~~~~~

// Reserved for GC500.

#define AQStallRegAddrs                                                   0x0F00
#define AQ_STALL_Address                                                 0x03C00
#define AQ_STALL_MSB                                                          15
#define AQ_STALL_LSB                                                           0
#define AQ_STALL_Count                                                         1
#define AQ_STALL_FieldMask                                            0xC0001F1F
#define AQ_STALL_ReadMask                                             0xC0001F1F
#define AQ_STALL_WriteMask                                            0xC0001F1F
#define AQ_STALL_ResetValue                                           0x00000000

// Reserved for GC500.
#define AQ_STALL_FLIP0                                                     30:30
#define AQ_STALL_FLIP0_End                                                    30
#define AQ_STALL_FLIP0_Start                                                  30

// Reserved for GC500.
#define AQ_STALL_FLIP1                                                     31:31
#define AQ_STALL_FLIP1_End                                                    31
#define AQ_STALL_FLIP1_Start                                                  31

#define AQ_STALL_SOURCE                                                      4:0
#define AQ_STALL_SOURCE_End                                                    4
#define AQ_STALL_SOURCE_Start                                                  0
#define   AQ_STALL_SOURCE_FRONT_END                                         0x01
#define   AQ_STALL_SOURCE_VERTEX_SHADER                                     0x02
#define   AQ_STALL_SOURCE_PRIMITIVE_ASSEMBLY                                0x03
#define   AQ_STALL_SOURCE_SETUP                                             0x04
#define   AQ_STALL_SOURCE_RASTERIZER                                        0x05
#define   AQ_STALL_SOURCE_PIXEL_SHADER                                      0x06
#define   AQ_STALL_SOURCE_PIXEL_ENGINE                                      0x07
#define   AQ_STALL_SOURCE_MEMORY_CONTROLLER                                 0x08
#define   AQ_STALL_SOURCE_DISPLAY_CONTROLLER0                               0x09
#define   AQ_STALL_SOURCE_DISPLAY_CONTROLLER1                               0x0A
#define   AQ_STALL_SOURCE_DRAWING_ENGINE                                    0x0B
#define   AQ_STALL_SOURCE_EVENT                                             0x0C
#define   AQ_STALL_SOURCE_RESOLVE                                           0x0D

#define AQ_STALL_DESTINATION                                                12:8
#define AQ_STALL_DESTINATION_End                                              12
#define AQ_STALL_DESTINATION_Start                                             8
#define   AQ_STALL_DESTINATION_FRONT_END                                    0x01
#define   AQ_STALL_DESTINATION_VERTEX_SHADER                                0x02
#define   AQ_STALL_DESTINATION_PRIMITIVE_ASSEMBLY                           0x03
#define   AQ_STALL_DESTINATION_SETUP                                        0x04
#define   AQ_STALL_DESTINATION_RASTERIZER                                   0x05
#define   AQ_STALL_DESTINATION_PIXEL_SHADER                                 0x06
#define   AQ_STALL_DESTINATION_PIXEL_ENGINE                                 0x07
#define   AQ_STALL_DESTINATION_MEMORY_CONTROLLER                            0x08
#define   AQ_STALL_DESTINATION_DISPLAY_CONTROLLER0                          0x09
#define   AQ_STALL_DESTINATION_DISPLAY_CONTROLLER1                          0x0A
#define   AQ_STALL_DESTINATION_DRAWING_ENGINE                               0x0B
#define   AQ_STALL_DESTINATION_EVENT                                        0x0C
#define   AQ_STALL_DESTINATION_RESOLVE                                      0x0D

// Register AQClear.
// ~~~~~~~~~~~~~~~~

// Reserved for GC500.

#define AQClearRegAddrs                                                   0x0F01
#define AQ_CLEAR_Address                                                 0x03C04
#define AQ_CLEAR_MSB                                                          15
#define AQ_CLEAR_LSB                                                           0
#define AQ_CLEAR_Count                                                         1
#define AQ_CLEAR_FieldMask                                            0x00000001
#define AQ_CLEAR_ReadMask                                             0x00000001
#define AQ_CLEAR_WriteMask                                            0x00000001
#define AQ_CLEAR_ResetValue                                           0x00000000

// Reserved for GC500.
#define AQ_CLEAR_FAST_CLEAR                                                  0:0
#define AQ_CLEAR_FAST_CLEAR_End                                                0
#define AQ_CLEAR_FAST_CLEAR_Start                                              0
#define   AQ_CLEAR_FAST_CLEAR_START                                          0x1

// Register AQTrigger.
// ~~~~~~~~~~~~~~~~~~

// Reserved for GC500.

#define AQTriggerRegAddrs                                                 0x0F02
#define AQ_TRIGGER_Address                                               0x03C08
#define AQ_TRIGGER_MSB                                                        15
#define AQ_TRIGGER_LSB                                                         0
#define AQ_TRIGGER_Count                                                       1
#define AQ_TRIGGER_FieldMask                                          0x000F1F1F
#define AQ_TRIGGER_ReadMask                                           0x000F1F1F
#define AQ_TRIGGER_WriteMask                                          0x000F1F1F
#define AQ_TRIGGER_ResetValue                                         0x00000000

// Reserved for GC500.
#define AQ_TRIGGER_ID                                                      19:16
#define AQ_TRIGGER_ID_End                                                     19
#define AQ_TRIGGER_ID_Start                                                   16

#define AQ_TRIGGER_SOURCE                                                    4:0
#define AQ_TRIGGER_SOURCE_End                                                  4
#define AQ_TRIGGER_SOURCE_Start                                                0
#define   AQ_TRIGGER_SOURCE_FRONT_END                                       0x01
#define   AQ_TRIGGER_SOURCE_VERTEX_SHADER                                   0x02
#define   AQ_TRIGGER_SOURCE_PRIMITIVE_ASSEMBLY                              0x03
#define   AQ_TRIGGER_SOURCE_SETUP                                           0x04
#define   AQ_TRIGGER_SOURCE_RASTERIZER                                      0x05
#define   AQ_TRIGGER_SOURCE_PIXEL_SHADER                                    0x06
#define   AQ_TRIGGER_SOURCE_PIXEL_ENGINE                                    0x07
#define   AQ_TRIGGER_SOURCE_MEMORY_CONTROLLER                               0x08
#define   AQ_TRIGGER_SOURCE_DISPLAY_CONTROLLER0                             0x09
#define   AQ_TRIGGER_SOURCE_DISPLAY_CONTROLLER1                             0x0A
#define   AQ_TRIGGER_SOURCE_DRAWING_ENGINE                                  0x0B
#define   AQ_TRIGGER_SOURCE_EVENT                                           0x0C
#define   AQ_TRIGGER_SOURCE_RESOLVE                                         0x0D

#define AQ_TRIGGER_DESTINATION                                              12:8
#define AQ_TRIGGER_DESTINATION_End                                            12
#define AQ_TRIGGER_DESTINATION_Start                                           8
#define   AQ_TRIGGER_DESTINATION_FRONT_END                                  0x01
#define   AQ_TRIGGER_DESTINATION_VERTEX_SHADER                              0x02
#define   AQ_TRIGGER_DESTINATION_PRIMITIVE_ASSEMBLY                         0x03
#define   AQ_TRIGGER_DESTINATION_SETUP                                      0x04
#define   AQ_TRIGGER_DESTINATION_RASTERIZER                                 0x05
#define   AQ_TRIGGER_DESTINATION_PIXEL_SHADER                               0x06
#define   AQ_TRIGGER_DESTINATION_PIXEL_ENGINE                               0x07
#define   AQ_TRIGGER_DESTINATION_MEMORY_CONTROLLER                          0x08
#define   AQ_TRIGGER_DESTINATION_DISPLAY_CONTROLLER0                        0x09
#define   AQ_TRIGGER_DESTINATION_DISPLAY_CONTROLLER1                        0x0A
#define   AQ_TRIGGER_DESTINATION_DRAWING_ENGINE                             0x0B
#define   AQ_TRIGGER_DESTINATION_EVENT                                      0x0C
#define   AQ_TRIGGER_DESTINATION_RESOLVE                                    0x0D

////////////////////////////////////////////////////////////////////////////////
//                         ~~~~~~~~~~~~~~~~~~~~~~~~~~                         //
//                         Command AQCommandLoadState                         //
//                         ~~~~~~~~~~~~~~~~~~~~~~~~~~                         //
////////////////////////////////////////////////////////////////////////////////

#define AQCommandLoadStateCmdAddrs                                        0x0F03
#define AQ_COMMAND_LOAD_STATE_Address                                    0x03C0C
#define AQ_COMMAND_LOAD_STATE_Count                                            1

// Offset Command.
// ~~~~~~~~~~~~~~
#define AQ_COMMAND_LOAD_STATE_COMMAND_Index                                    0
#define AQ_COMMAND_LOAD_STATE_COMMAND_CmdAddrs                            0x0F03

// When enabled, convert 16.16 fixed point into 32-bit
// floating point.
#define AQ_COMMAND_LOAD_STATE_COMMAND_FLOAT                                26:26
#define AQ_COMMAND_LOAD_STATE_COMMAND_FLOAT_End                               26
#define AQ_COMMAND_LOAD_STATE_COMMAND_FLOAT_Start                             26
#define   AQ_COMMAND_LOAD_STATE_COMMAND_FLOAT_NORMAL                         0x0
#define   AQ_COMMAND_LOAD_STATE_COMMAND_FLOAT_FIXED16_DOT16                  0x1

// Number of states. 0 = 1024.
#define AQ_COMMAND_LOAD_STATE_COMMAND_COUNT                                25:16
#define AQ_COMMAND_LOAD_STATE_COMMAND_COUNT_End                               25
#define AQ_COMMAND_LOAD_STATE_COMMAND_COUNT_Start                             16

// Starting state address.
#define AQ_COMMAND_LOAD_STATE_COMMAND_ADDRESS                               15:0
#define AQ_COMMAND_LOAD_STATE_COMMAND_ADDRESS_End                             15
#define AQ_COMMAND_LOAD_STATE_COMMAND_ADDRESS_Start                            0

#define AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE                               31:27
#define AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_End                              31
#define AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_Start                            27
#define   AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_LOAD_STATE                   0x01
#define   AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_END                          0x02
#define   AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_NOP                          0x03
#define   AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_START_DE                     0x04
#define   AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_DX8_DRAW_PRIMITIVE           0x05
#define   AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_DX8_DRAW_INDEX_PRIMITIVE     0x06
#define   AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_WAIT                         0x07
#define   AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_LINK                         0x08
#define   AQ_COMMAND_LOAD_STATE_COMMAND_OPCODE_STALL                        0x09

////////////////////////////////////////////////////////////////////////////////
//                            ~~~~~~~~~~~~~~~~~~~~                            //
//                            Command AQCommandEnd                            //
//                            ~~~~~~~~~~~~~~~~~~~~                            //
////////////////////////////////////////////////////////////////////////////////

#define AQCommandEndCmdAddrs                                              0x0F04
#define AQ_COMMAND_END_Address                                           0x03C10
#define AQ_COMMAND_END_Count                                                   1

// Offset Command.
// ~~~~~~~~~~~~~~
#define AQ_COMMAND_END_COMMAND_Index                                           0
#define AQ_COMMAND_END_COMMAND_CmdAddrs                                   0x0F04

#define AQ_COMMAND_END_COMMAND_OPCODE                                      31:27
#define AQ_COMMAND_END_COMMAND_OPCODE_End                                     31
#define AQ_COMMAND_END_COMMAND_OPCODE_Start                                   27
#define   AQ_COMMAND_END_COMMAND_OPCODE_LOAD_STATE                          0x01
#define   AQ_COMMAND_END_COMMAND_OPCODE_END                                 0x02
#define   AQ_COMMAND_END_COMMAND_OPCODE_NOP                                 0x03
#define   AQ_COMMAND_END_COMMAND_OPCODE_START_DE                            0x04
#define   AQ_COMMAND_END_COMMAND_OPCODE_DX8_DRAW_PRIMITIVE                  0x05
#define   AQ_COMMAND_END_COMMAND_OPCODE_DX8_DRAW_INDEX_PRIMITIVE            0x06
#define   AQ_COMMAND_END_COMMAND_OPCODE_WAIT                                0x07
#define   AQ_COMMAND_END_COMMAND_OPCODE_LINK                                0x08
#define   AQ_COMMAND_END_COMMAND_OPCODE_STALL                               0x09

////////////////////////////////////////////////////////////////////////////////
//                            ~~~~~~~~~~~~~~~~~~~~                            //
//                            Command AQCommandNop                            //
//                            ~~~~~~~~~~~~~~~~~~~~                            //
////////////////////////////////////////////////////////////////////////////////

#define AQCommandNopCmdAddrs                                              0x0F05
#define AQ_COMMAND_NOP_Address                                           0x03C14
#define AQ_COMMAND_NOP_Count                                                   1

// Offset Command.
// ~~~~~~~~~~~~~~
#define AQ_COMMAND_NOP_COMMAND_Index                                           0
#define AQ_COMMAND_NOP_COMMAND_CmdAddrs                                   0x0F05

#define AQ_COMMAND_NOP_COMMAND_OPCODE                                      31:27
#define AQ_COMMAND_NOP_COMMAND_OPCODE_End                                     31
#define AQ_COMMAND_NOP_COMMAND_OPCODE_Start                                   27
#define   AQ_COMMAND_NOP_COMMAND_OPCODE_LOAD_STATE                          0x01
#define   AQ_COMMAND_NOP_COMMAND_OPCODE_END                                 0x02
#define   AQ_COMMAND_NOP_COMMAND_OPCODE_NOP                                 0x03
#define   AQ_COMMAND_NOP_COMMAND_OPCODE_START_DE                            0x04
#define   AQ_COMMAND_NOP_COMMAND_OPCODE_DX8_DRAW_PRIMITIVE                  0x05
#define   AQ_COMMAND_NOP_COMMAND_OPCODE_DX8_DRAW_INDEX_PRIMITIVE            0x06
#define   AQ_COMMAND_NOP_COMMAND_OPCODE_WAIT                                0x07
#define   AQ_COMMAND_NOP_COMMAND_OPCODE_LINK                                0x08
#define   AQ_COMMAND_NOP_COMMAND_OPCODE_STALL                               0x09

////////////////////////////////////////////////////////////////////////////////
//                          ~~~~~~~~~~~~~~~~~~~~~~~~                          //
//                          Command AQCommandStartDE                          //
//                          ~~~~~~~~~~~~~~~~~~~~~~~~                          //
////////////////////////////////////////////////////////////////////////////////

#define AQCommandStartDECmdAddrs                                          0x0F06
#define AQ_COMMAND_START_DE_Address                                      0x03C18
#define AQ_COMMAND_START_DE_Count                                              1

// Offset Command.
// ~~~~~~~~~~~~~~
#define AQ_COMMAND_START_DE_COMMAND_Index                                      0
#define AQ_COMMAND_START_DE_COMMAND_CmdAddrs                              0x0F06

// Number of 32-bit data words to send.  The data follows the
// rectangles, aligned at 64-bit.
#define AQ_COMMAND_START_DE_COMMAND_DATA_COUNT                             26:16
#define AQ_COMMAND_START_DE_COMMAND_DATA_COUNT_End                            26
#define AQ_COMMAND_START_DE_COMMAND_DATA_COUNT_Start                          16

// Number of rectangles to send.  The rectangles follow the
// command, aligned at 64-bit.
#define AQ_COMMAND_START_DE_COMMAND_COUNT                                   15:8
#define AQ_COMMAND_START_DE_COMMAND_COUNT_End                                 15
#define AQ_COMMAND_START_DE_COMMAND_COUNT_Start                                8

#define AQ_COMMAND_START_DE_COMMAND_OPCODE                                 31:27
#define AQ_COMMAND_START_DE_COMMAND_OPCODE_End                                31
#define AQ_COMMAND_START_DE_COMMAND_OPCODE_Start                              27
#define   AQ_COMMAND_START_DE_COMMAND_OPCODE_LOAD_STATE                     0x01
#define   AQ_COMMAND_START_DE_COMMAND_OPCODE_END                            0x02
#define   AQ_COMMAND_START_DE_COMMAND_OPCODE_NOP                            0x03
#define   AQ_COMMAND_START_DE_COMMAND_OPCODE_START_DE                       0x04
#define   AQ_COMMAND_START_DE_COMMAND_OPCODE_DX8_DRAW_PRIMITIVE             0x05
#define   AQ_COMMAND_START_DE_COMMAND_OPCODE_DX8_DRAW_INDEX_PRIMITIVE       0x06
#define   AQ_COMMAND_START_DE_COMMAND_OPCODE_WAIT                           0x07
#define   AQ_COMMAND_START_DE_COMMAND_OPCODE_LINK                           0x08
#define   AQ_COMMAND_START_DE_COMMAND_OPCODE_STALL                          0x09

////////////////////////////////////////////////////////////////////////////////
//                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                     //
//                      Command AQCommandDX8DrawPrimitive                     //
//                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                     //
////////////////////////////////////////////////////////////////////////////////

#define AQCommandDX8DrawPrimitiveCmdAddrs                                 0x0F08
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_Address                            0x03C20
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_Count                                    4

// Offset Command.
// ~~~~~~~~~~~~~~
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_Index                            0
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_CmdAddrs                    0x0F08

#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE                       31:27
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_End                      31
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_Start                    27
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_LOAD_STATE           0x01
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_END                  0x02
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_NOP                  0x03
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_START_DE             0x04
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_DX8_DRAW_PRIMITIVE   0x05
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_DX8_DRAW_INDEX_PRIMITIVE 0x06
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_WAIT                 0x07
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_LINK                 0x08
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_COMMAND_OPCODE_STALL                0x09

// Offset Primtype.
// ~~~~~~~~~~~~~~~
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_Index                           1
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_CmdAddrs                   0x0F09

// Primitive type.
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE                          2:0
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE_End                        2
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE_Start                      0
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE_POINT_LIST             0x1
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE_LINE_LIST              0x2
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE_LINE_STRIP             0x3
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE_TRIANGLE_LIST          0x4
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE_TRIANGLE_STRIP         0x5
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE_TRIANGLE_FAN           0x6
#define   AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_TYPE_LINE_LOOP              0x7

// Reserved for GC500.
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_INSTANCE                    31:16
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_INSTANCE_End                   31
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMTYPE_INSTANCE_Start                 16

// Offset Vertexstart.
// ~~~~~~~~~~~~~~~~~~
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_VERTEXSTART_Index                        2
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_VERTEXSTART_CmdAddrs                0x0F0A

// Index into vertex stream for first primitive.
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_VERTEXSTART_INDEX                     19:0
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_VERTEXSTART_INDEX_End                   19
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_VERTEXSTART_INDEX_Start                  0

// Offset Primcount.
// ~~~~~~~~~~~~~~~~
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMCOUNT_Index                          3
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMCOUNT_CmdAddrs                  0x0F0B

// Number of primitives to draw.
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMCOUNT_COUNT                       19:0
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMCOUNT_COUNT_End                     19
#define AQ_COMMAND_DX8_DRAW_PRIMITIVE_PRIMCOUNT_COUNT_Start                    0

////////////////////////////////////////////////////////////////////////////////
//                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                   //
//                   Command AQCommandDX8DrawIndexPrimitive                   //
//                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                   //
////////////////////////////////////////////////////////////////////////////////

#define AQCommandDX8DrawIndexPrimitiveCmdAddrs                            0x0F10
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_Address                      0x03C40
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_Count                              5

// Offset Command.
// ~~~~~~~~~~~~~~
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_Index                      0
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_CmdAddrs              0x0F10

#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE                 31:27
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_End                31
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_Start              27
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_LOAD_STATE     0x01
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_END            0x02
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_NOP            0x03
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_START_DE       0x04
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_DX8_DRAW_PRIMITIVE 0x05
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_DX8_DRAW_INDEX_PRIMITIVE 0x06
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_WAIT           0x07
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_LINK           0x08
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_COMMAND_OPCODE_STALL          0x09

// Offset Primtype.
// ~~~~~~~~~~~~~~~
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_Index                     1
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_CmdAddrs             0x0F11

// Primitive type.
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE                    2:0
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE_End                  2
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE_Start                0
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE_POINT_LIST       0x1
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE_LINE_LIST        0x2
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE_LINE_STRIP       0x3
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE_TRIANGLE_LIST    0x4
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE_TRIANGLE_STRIP   0x5
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE_TRIANGLE_FAN     0x6
#define   AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_TYPE_LINE_LOOP        0x7

// Reserved for GC500.
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_INSTANCE              31:16
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_INSTANCE_End             31
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMTYPE_INSTANCE_Start           16

// Offset Start.
// ~~~~~~~~~~~~
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_START_Index                        2
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_START_CmdAddrs                0x0F12

// Index into index buffer for first primitive.
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_START_INDEX                     19:0
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_START_INDEX_End                   19
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_START_INDEX_Start                  0

// Offset Primcount.
// ~~~~~~~~~~~~~~~~
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMCOUNT_Index                    3
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMCOUNT_CmdAddrs            0x0F13

// Number of primitives to draw.
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMCOUNT_COUNT                 19:0
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMCOUNT_COUNT_End               19
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_PRIMCOUNT_COUNT_Start              0

// Offset Basevertex.
// ~~~~~~~~~~~~~~~~~
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_BASEVERTEX_Index                   4
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_BASEVERTEX_CmdAddrs           0x0F14

// Value added to each index fetched to create an index into
// the vertex stream.
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_BASEVERTEX_INDEX                31:0
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_BASEVERTEX_INDEX_End              31
#define AQ_COMMAND_DX8_DRAW_INDEX_PRIMITIVE_BASEVERTEX_INDEX_Start             0

////////////////////////////////////////////////////////////////////////////////
//                            ~~~~~~~~~~~~~~~~~~~~~                           //
//                            Command AQCommandWait                           //
//                            ~~~~~~~~~~~~~~~~~~~~~                           //
////////////////////////////////////////////////////////////////////////////////

#define AQCommandWaitCmdAddrs                                             0x0F07
#define AQ_COMMAND_WAIT_Address                                          0x03C1C
#define AQ_COMMAND_WAIT_Count                                                  1

// Offset Command.
// ~~~~~~~~~~~~~~
#define AQ_COMMAND_WAIT_COMMAND_Index                                          0
#define AQ_COMMAND_WAIT_COMMAND_CmdAddrs                                  0x0F07

// Number of cycles to wait in the prefetcher.
#define AQ_COMMAND_WAIT_COMMAND_DELAY                                       15:0
#define AQ_COMMAND_WAIT_COMMAND_DELAY_End                                     15
#define AQ_COMMAND_WAIT_COMMAND_DELAY_Start                                    0

#define AQ_COMMAND_WAIT_COMMAND_OPCODE                                     31:27
#define AQ_COMMAND_WAIT_COMMAND_OPCODE_End                                    31
#define AQ_COMMAND_WAIT_COMMAND_OPCODE_Start                                  27
#define   AQ_COMMAND_WAIT_COMMAND_OPCODE_LOAD_STATE                         0x01
#define   AQ_COMMAND_WAIT_COMMAND_OPCODE_END                                0x02
#define   AQ_COMMAND_WAIT_COMMAND_OPCODE_NOP                                0x03
#define   AQ_COMMAND_WAIT_COMMAND_OPCODE_START_DE                           0x04
#define   AQ_COMMAND_WAIT_COMMAND_OPCODE_DX8_DRAW_PRIMITIVE                 0x05
#define   AQ_COMMAND_WAIT_COMMAND_OPCODE_DX8_DRAW_INDEX_PRIMITIVE           0x06
#define   AQ_COMMAND_WAIT_COMMAND_OPCODE_WAIT                               0x07
#define   AQ_COMMAND_WAIT_COMMAND_OPCODE_LINK                               0x08
#define   AQ_COMMAND_WAIT_COMMAND_OPCODE_STALL                              0x09

////////////////////////////////////////////////////////////////////////////////
//                            ~~~~~~~~~~~~~~~~~~~~~                           //
//                            Command AQCommandLink                           //
//                            ~~~~~~~~~~~~~~~~~~~~~                           //
////////////////////////////////////////////////////////////////////////////////

#define AQCommandLinkCmdAddrs                                             0x0F0C
#define AQ_COMMAND_LINK_Address                                          0x03C30
#define AQ_COMMAND_LINK_Count                                                  2

// Offset Command.
// ~~~~~~~~~~~~~~
#define AQ_COMMAND_LINK_COMMAND_Index                                          0
#define AQ_COMMAND_LINK_COMMAND_CmdAddrs                                  0x0F0C

// Number of 64-bit words to fetch.
#define AQ_COMMAND_LINK_COMMAND_PREFETCH                                    15:0
#define AQ_COMMAND_LINK_COMMAND_PREFETCH_End                                  15
#define AQ_COMMAND_LINK_COMMAND_PREFETCH_Start                                 0

#define AQ_COMMAND_LINK_COMMAND_OPCODE                                     31:27
#define AQ_COMMAND_LINK_COMMAND_OPCODE_End                                    31
#define AQ_COMMAND_LINK_COMMAND_OPCODE_Start                                  27
#define   AQ_COMMAND_LINK_COMMAND_OPCODE_LOAD_STATE                         0x01
#define   AQ_COMMAND_LINK_COMMAND_OPCODE_END                                0x02
#define   AQ_COMMAND_LINK_COMMAND_OPCODE_NOP                                0x03
#define   AQ_COMMAND_LINK_COMMAND_OPCODE_START_DE                           0x04
#define   AQ_COMMAND_LINK_COMMAND_OPCODE_DX8_DRAW_PRIMITIVE                 0x05
#define   AQ_COMMAND_LINK_COMMAND_OPCODE_DX8_DRAW_INDEX_PRIMITIVE           0x06
#define   AQ_COMMAND_LINK_COMMAND_OPCODE_WAIT                               0x07
#define   AQ_COMMAND_LINK_COMMAND_OPCODE_LINK                               0x08
#define   AQ_COMMAND_LINK_COMMAND_OPCODE_STALL                              0x09

// Offset Address.
// ~~~~~~~~~~~~~~
#define AQ_COMMAND_LINK_ADDRESS_Index                                          1
#define AQ_COMMAND_LINK_ADDRESS_CmdAddrs                                  0x0F0D

#define AQ_COMMAND_LINK_ADDRESS_TYPE                                       31:31
#define AQ_COMMAND_LINK_ADDRESS_TYPE_End                                      31
#define AQ_COMMAND_LINK_ADDRESS_TYPE_Start                                    31
#define   AQ_COMMAND_LINK_ADDRESS_TYPE_SYSTEM                                0x0
#define   AQ_COMMAND_LINK_ADDRESS_TYPE_VIRTUAL_SYSTEM                        0x1

#define AQ_COMMAND_LINK_ADDRESS_ADDRESS                                     30:0
#define AQ_COMMAND_LINK_ADDRESS_ADDRESS_End                                   30
#define AQ_COMMAND_LINK_ADDRESS_ADDRESS_Start                                  0

////////////////////////////////////////////////////////////////////////////////
//                              ~~~~~~~~~~~~~~~~~                             //
//                              Command AQCommand                             //
//                              ~~~~~~~~~~~~~~~~~                             //
////////////////////////////////////////////////////////////////////////////////

// Offset Pipe.
// ~~~~~~~~~~~

#define AQ_COMMAND_PIPE_PIPE                                                 1:0
#define AQ_COMMAND_PIPE_PIPE_End                                               1
#define AQ_COMMAND_PIPE_PIPE_Start                                             0
#define   AQ_COMMAND_PIPE_PIPE_3D                                            0x0
#define   AQ_COMMAND_PIPE_PIPE_2D                                            0x1
#define   AQ_COMMAND_PIPE_PIPE_VIDEO                                         0x2

// Offset Opcode.
// ~~~~~~~~~~~~~

#define AQ_COMMAND_OPCODE_OPCODE                                           31:27
#define AQ_COMMAND_OPCODE_OPCODE_End                                          31
#define AQ_COMMAND_OPCODE_OPCODE_Start                                        27
#define   AQ_COMMAND_OPCODE_OPCODE_LOAD_STATE                               0x01
#define   AQ_COMMAND_OPCODE_OPCODE_END                                      0x02
#define   AQ_COMMAND_OPCODE_OPCODE_NOP                                      0x03
#define   AQ_COMMAND_OPCODE_OPCODE_START_DE                                 0x04
#define   AQ_COMMAND_OPCODE_OPCODE_DX8_DRAW_PRIMITIVE                       0x05
#define   AQ_COMMAND_OPCODE_OPCODE_DX8_DRAW_INDEX_PRIMITIVE                 0x06
#define   AQ_COMMAND_OPCODE_OPCODE_WAIT                                     0x07
#define   AQ_COMMAND_OPCODE_OPCODE_LINK                                     0x08
#define   AQ_COMMAND_OPCODE_OPCODE_STALL                                    0x09

// Offset Color.
// ~~~~~~~~~~~~

#define AQ_COMMAND_COLOR_ALPHA                                             31:24
#define AQ_COMMAND_COLOR_ALPHA_End                                            31
#define AQ_COMMAND_COLOR_ALPHA_Start                                          24

#define AQ_COMMAND_COLOR_RED                                               23:16
#define AQ_COMMAND_COLOR_RED_End                                              23
#define AQ_COMMAND_COLOR_RED_Start                                            16

#define AQ_COMMAND_COLOR_GREEN                                              15:8
#define AQ_COMMAND_COLOR_GREEN_End                                            15
#define AQ_COMMAND_COLOR_GREEN_Start                                           8

#define AQ_COMMAND_COLOR_BLUE                                                7:0
#define AQ_COMMAND_COLOR_BLUE_End                                              7
#define AQ_COMMAND_COLOR_BLUE_Start                                            0

// Offset TopLeft.
// ~~~~~~~~~~~~~~

#define AQ_COMMAND_TOP_LEFT_Y                                              31:16
#define AQ_COMMAND_TOP_LEFT_Y_End                                             31
#define AQ_COMMAND_TOP_LEFT_Y_Start                                           16

#define AQ_COMMAND_TOP_LEFT_X                                               15:0
#define AQ_COMMAND_TOP_LEFT_X_End                                             15
#define AQ_COMMAND_TOP_LEFT_X_Start                                            0

// Offset BottomRight.
// ~~~~~~~~~~~~~~~~~~

#define AQ_COMMAND_BOTTOM_RIGHT_Y                                          31:16
#define AQ_COMMAND_BOTTOM_RIGHT_Y_End                                         31
#define AQ_COMMAND_BOTTOM_RIGHT_Y_Start                                       16

#define AQ_COMMAND_BOTTOM_RIGHT_X                                           15:0
#define AQ_COMMAND_BOTTOM_RIGHT_X_End                                         15
#define AQ_COMMAND_BOTTOM_RIGHT_X_Start                                        0

// Offset Prim.
// ~~~~~~~~~~~

#define AQ_COMMAND_PRIM_TYPE                                                31:0
#define AQ_COMMAND_PRIM_TYPE_End                                              31
#define AQ_COMMAND_PRIM_TYPE_Start                                             0
#define   AQ_COMMAND_PRIM_TYPE_POINT_LIST                             0x00000001
#define   AQ_COMMAND_PRIM_TYPE_LINE_LIST                              0x00000002
#define   AQ_COMMAND_PRIM_TYPE_LINE_STRIP                             0x00000003
#define   AQ_COMMAND_PRIM_TYPE_TRIANGLE_LIST                          0x00000004
#define   AQ_COMMAND_PRIM_TYPE_TRIANGLE_STRIP                         0x00000005
#define   AQ_COMMAND_PRIM_TYPE_TRIANGLE_FAN                           0x00000006
#define   AQ_COMMAND_PRIM_TYPE_LINE_LOOP                              0x00000007

// Offset Byte4.
// ~~~~~~~~~~~~

#define AQ_COMMAND_BYTE4_B0                                                  7:0
#define AQ_COMMAND_BYTE4_B0_End                                                7
#define AQ_COMMAND_BYTE4_B0_Start                                              0

#define AQ_COMMAND_BYTE4_B1                                                 15:8
#define AQ_COMMAND_BYTE4_B1_End                                               15
#define AQ_COMMAND_BYTE4_B1_Start                                              8

#define AQ_COMMAND_BYTE4_B2                                                23:16
#define AQ_COMMAND_BYTE4_B2_End                                               23
#define AQ_COMMAND_BYTE4_B2_Start                                             16

#define AQ_COMMAND_BYTE4_B3                                                31:24
#define AQ_COMMAND_BYTE4_B3_End                                               31
#define AQ_COMMAND_BYTE4_B3_Start                                             24

// Offset Short2.
// ~~~~~~~~~~~~~

#define AQ_COMMAND_SHORT2_S0                                                15:0
#define AQ_COMMAND_SHORT2_S0_End                                              15
#define AQ_COMMAND_SHORT2_S0_Start                                             0

#define AQ_COMMAND_SHORT2_S1                                               31:16
#define AQ_COMMAND_SHORT2_S1_End                                              31
#define AQ_COMMAND_SHORT2_S1_Start                                            16

// Offset Dec3.
// ~~~~~~~~~~~

#define AQ_COMMAND_DEC3_D0                                                   9:0
#define AQ_COMMAND_DEC3_D0_End                                                 9
#define AQ_COMMAND_DEC3_D0_Start                                               0

#define AQ_COMMAND_DEC3_D1                                                 19:10
#define AQ_COMMAND_DEC3_D1_End                                                19
#define AQ_COMMAND_DEC3_D1_Start                                              10

#define AQ_COMMAND_DEC3_D2                                                 29:20
#define AQ_COMMAND_DEC3_D2_End                                                29
#define AQ_COMMAND_DEC3_D2_Start                                              20

// Offset Float16.
// ~~~~~~~~~~~~~~

#define AQ_COMMAND_FLOAT16_F0                                               15:0
#define AQ_COMMAND_FLOAT16_F0_End                                             15
#define AQ_COMMAND_FLOAT16_F0_Start                                            0

#define AQ_COMMAND_FLOAT16_F1                                              31:16
#define AQ_COMMAND_FLOAT16_F1_End                                             31
#define AQ_COMMAND_FLOAT16_F1_Start                                           16

////////////////////////////////////////////////////////////////////////////////
//                                ~~~~~~~~~~~~~                               //
//                                Command Stall                               //
//                                ~~~~~~~~~~~~~                               //
////////////////////////////////////////////////////////////////////////////////

#define StallCmdAddrs                                                     0x0F0E
#define STALL_Address                                                    0x03C38
#define STALL_Count                                                            2

// Offset Command.
// ~~~~~~~~~~~~~~
#define STALL_COMMAND_Index                                                    0
#define STALL_COMMAND_CmdAddrs                                            0x0F0E

#define STALL_COMMAND_OPCODE                                               31:27
#define STALL_COMMAND_OPCODE_End                                              31
#define STALL_COMMAND_OPCODE_Start                                            27
#define   STALL_COMMAND_OPCODE_LOAD_STATE                                   0x01
#define   STALL_COMMAND_OPCODE_END                                          0x02
#define   STALL_COMMAND_OPCODE_NOP                                          0x03
#define   STALL_COMMAND_OPCODE_START_DE                                     0x04
#define   STALL_COMMAND_OPCODE_DX8_DRAW_PRIMITIVE                           0x05
#define   STALL_COMMAND_OPCODE_DX8_DRAW_INDEX_PRIMITIVE                     0x06
#define   STALL_COMMAND_OPCODE_WAIT                                         0x07
#define   STALL_COMMAND_OPCODE_LINK                                         0x08
#define   STALL_COMMAND_OPCODE_STALL                                        0x09

// Offset Stall.
// ~~~~~~~~~~~~
#define STALL_STALL_Index                                                      1
#define STALL_STALL_CmdAddrs                                              0x0F0F

#define STALL_STALL_SOURCE                                                   4:0
#define STALL_STALL_SOURCE_End                                                 4
#define STALL_STALL_SOURCE_Start                                               0
#define   STALL_STALL_SOURCE_FRONT_END                                      0x01
#define   STALL_STALL_SOURCE_VERTEX_SHADER                                  0x02
#define   STALL_STALL_SOURCE_PRIMITIVE_ASSEMBLY                             0x03
#define   STALL_STALL_SOURCE_SETUP                                          0x04
#define   STALL_STALL_SOURCE_RASTERIZER                                     0x05
#define   STALL_STALL_SOURCE_PIXEL_SHADER                                   0x06
#define   STALL_STALL_SOURCE_PIXEL_ENGINE                                   0x07
#define   STALL_STALL_SOURCE_MEMORY_CONTROLLER                              0x08
#define   STALL_STALL_SOURCE_DISPLAY_CONTROLLER0                            0x09
#define   STALL_STALL_SOURCE_DISPLAY_CONTROLLER1                            0x0A
#define   STALL_STALL_SOURCE_DRAWING_ENGINE                                 0x0B
#define   STALL_STALL_SOURCE_EVENT                                          0x0C
#define   STALL_STALL_SOURCE_RESOLVE                                        0x0D

#define STALL_STALL_DESTINATION                                             12:8
#define STALL_STALL_DESTINATION_End                                           12
#define STALL_STALL_DESTINATION_Start                                          8
#define   STALL_STALL_DESTINATION_FRONT_END                                 0x01
#define   STALL_STALL_DESTINATION_VERTEX_SHADER                             0x02
#define   STALL_STALL_DESTINATION_PRIMITIVE_ASSEMBLY                        0x03
#define   STALL_STALL_DESTINATION_SETUP                                     0x04
#define   STALL_STALL_DESTINATION_RASTERIZER                                0x05
#define   STALL_STALL_DESTINATION_PIXEL_SHADER                              0x06
#define   STALL_STALL_DESTINATION_PIXEL_ENGINE                              0x07
#define   STALL_STALL_DESTINATION_MEMORY_CONTROLLER                         0x08
#define   STALL_STALL_DESTINATION_DISPLAY_CONTROLLER0                       0x09
#define   STALL_STALL_DESTINATION_DISPLAY_CONTROLLER1                       0x0A
#define   STALL_STALL_DESTINATION_DRAWING_ENGINE                            0x0B
#define   STALL_STALL_DESTINATION_EVENT                                     0x0C
#define   STALL_STALL_DESTINATION_RESOLVE                                   0x0D

